import '@feidao/web/atom/nodejs/interfaces';
import html from './html';
import s from './ns';

// dask
import init from '@feidao/web/framework/nodejs/d/page';
// drools + dask
// import init from '@feidao/web/framework/nodejs/dn/page';

////////////////////////////////////////////////////////////////////////////////
// import actions
import na001 from './na001';
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// import components
import c001 from '../zj-test-001/n';
////////////////////////////////////////////////////////////////////////////////

feidao_exports.default = async (url: string) => {
	const daoke = {
		na001/**, na002, na003 */
	};

	await init(html, url, s, daoke, c001/** c002, c003*/);
	return `
	<!DOCTYPE html>
	<html>

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>Main Page</title>
		<!-- @daoke dependencies begin -->
		<!-- todo: need use cdn -->
		<link href="https://cdn.jsdelivr.net/npm/purecss" type="text/css" rel="stylesheet">
		<link href="https://cdn.jsdelivr.net/npm/feidao-css/feidao.css" type="text/css" rel="stylesheet">
		<link id="theme" href="https://cdn.jsdelivr.net/npm/feidao-css/theme/blue.css" type="text/css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="./css/iconfont.css">
		<link rel="stylesheet" type="text/css" href="./css/daokes.css">
		<!-- @daoke dependencies end -->
		<!-- @widgets dependencies begin -->
		<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
		<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
		<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
		<link href="https://cdn.bootcss.com/bootstrap-multiselect/0.9.13/css/bootstrap-multiselect.css" rel="stylesheet">
		<script src="https://cdn.bootcss.com/bootstrap-multiselect/0.9.13/js/bootstrap-multiselect.min.js"></script>
		<!-- @widgets dependencies end -->
		<!-- @atom dependencies begin -->
		<script src="https://cdn.jsdelivr.net/npm/qiniu-js/dist/qiniu.min.js"></script>
		<!-- @atom dependencies end -->
		<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
		<script src="./js/feidao.js"></script>

		<script type="text/javascript">
			window.addEventListener('WebComponentsReady', function () {
				var t = document.createElement('script');
				t.src = './js/@page.js';
				document.head.appendChild(t);
			});
		</script>
	</head>
	<body>
	${html.toString()}
	</body>
</html>
	`;
};
